package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.LgAutoWired;
import com.lagou.edu.mvcframework.annotations.LgController;
import com.lagou.edu.mvcframework.annotations.LgRequestMapping;
import com.lagou.edu.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@LgController
@LgRequestMapping("/demo")
@Security(value = "jet")
public class DemoController {
    @LgAutoWired
    private IDemoService demoService;

    @LgRequestMapping("/query")
    public String query( HttpServletRequest request, HttpServletResponse response, String name){
        System.out.println("query开始执行.........");
        return  demoService.get(name);

    }

    /*
    * http://localhost:8080/demo/handle01?username=lisi&name=zhangsan
    *http://localhost:8080/demo/handle01?username=zhaosi&name=zhangsan
    * */

    @LgRequestMapping("/handle01")
    @Security(value = {"lisi","wangwu"})
    public String handle01( HttpServletRequest request, HttpServletResponse response, String name){
        System.out.println("handle01开始执行.........");
        return  demoService.get(name);

    }
}
